package com.aidex.system.controller;

import java.util.List;
import com.aidex.common.annotation.Log;
import com.aidex.common.core.domain.R;
import com.github.pagehelper.PageInfo;
import com.aidex.common.core.page.PageDomain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.aidex.common.enums.BusinessType;
import com.aidex.common.utils.poi.ExcelUtil;
import javax.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import com.aidex.common.core.controller.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import com.aidex.system.domain.VCsisBusinessAsd;
import com.aidex.system.service.VCsisBusinessAsdService;

/**
 * 申报数据Controller
 * @author wll
 * @email wll
 * @date 2021-10-14
 */
@RestController
@RequestMapping("/system/vCsisBusinessAsd")
public class VCsisBusinessAsdController extends BaseController
{
    @Autowired
    private VCsisBusinessAsdService vCsisBusinessAsdService;

    /**
     * 查询申报数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessAsd:list')")
    @GetMapping("/list")
    public R<PageInfo> list(VCsisBusinessAsd vCsisBusinessAsd, HttpServletRequest request, HttpServletResponse response)
    {
        vCsisBusinessAsd.setPage(new PageDomain(request, response));
        return R.data(vCsisBusinessAsdService.findPage(vCsisBusinessAsd));
    }

    /**
     * 获取申报数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessAsd:query')")
    @GetMapping(value = "/{id}")
    public R<VCsisBusinessAsd> detail(@PathVariable("id") String id)
    {
        return R.data(vCsisBusinessAsdService.get(id));
    }

    /**
     * 新增申报数据
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessAsd:add')")
    @Log(title = "申报数据", businessType = BusinessType.INSERT)
    @PostMapping
    public R add(@RequestBody @Validated  VCsisBusinessAsd vCsisBusinessAsd)
    {
        return R.status(vCsisBusinessAsdService.save(vCsisBusinessAsd));
    }

    /**
     * 修改申报数据
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessAsd:edit')")
    @Log(title = "申报数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public R edit(@RequestBody @Validated VCsisBusinessAsd vCsisBusinessAsd)
    {
        return R.status(vCsisBusinessAsdService.save(vCsisBusinessAsd));
    }


    /**
     * 删除申报数据
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessAsd:remove')")
    @Log(title = "申报数据", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R remove(@PathVariable String[] ids)
    {
        return R.status(vCsisBusinessAsdService.deleteVCsisBusinessAsdByIds(ids));
    }


    /**
     * 导出申报数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vCsisBusinessAsd:export')")
    @Log(title = "申报数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public R export(VCsisBusinessAsd vCsisBusinessAsd)
    {
        List<VCsisBusinessAsd> list = vCsisBusinessAsdService.findList(vCsisBusinessAsd);
        ExcelUtil<VCsisBusinessAsd> util = new ExcelUtil<VCsisBusinessAsd>(VCsisBusinessAsd.class);
        return util.exportExcel(list, "vCsisBusinessAsd");
    }

}
